<template>
	<app-page>
		<wd-config-provider :theme="theme">
			<view class="container">
				<wd-cell-group custom-class="cell">
					<wd-input type="number" show-password v-model="formData.oldpassword" placeholder="请输入旧密码"
						label="原始密码" required></wd-input>
					<wd-input type="number" show-password v-model="formData.password" placeholder="请输入新密码" label="新密码"
						required></wd-input>
					<wd-input type="number" show-password v-model="formData.repassword" placeholder="请输入新密码" label="新密码"
						required></wd-input>
				</wd-cell-group>
				<view class="submit-btns">
					<wd-button type="success"
						custom-class="wd-button-custom-class-my-success wd-button-custom-class-w100"
						@click="submit">提交</wd-button>
				</view>
			</view>
		</wd-config-provider>
	</app-page>
</template>

<script lang="ts">
	import { defineComponent, ref } from 'vue';
	import { useUserStore } from '@/store';
	export default defineComponent({
		name: '',
		setup(props, ctx) {
			const userStore = useUserStore();
			// 日间light、夜间dark主题
			const theme = ref('light');
			const formData = ref({
				oldpassword: "",
				password: "",
				repassword: "",
			})
			const submit = () => {
				userStore.doUpPwd(formData.value)
			}
			return {
				theme,
				formData,
				submit
			};
		}
	});
</script>
<!-- #ifdef MP-WEIXIN -->
<style lang="less">
	page {
		background-color: #f2f2f2;
	}
</style>
<!-- #endif -->
<style lang="less" scoped>
	page {
		background-color: #f2f2f2;
	}

	.container {
		position: relative;
		padding: 24rpx;

		.cell {
			border-radius: 10rpx;
			overflow: hidden;
			padding: 10rpx;
		}

		.submit-btns {
			display: flex;
			margin-top: 150rpx;
			margin-bottom: 40rpx;
		}
	}
</style>